<div id="scrollFiexBox" style="position: fixed;right: 50px;bottom: 50px;">
    <button onclick="gundongScroll(false)" title="向上滚动" style="margin-bottom: 10px;" class="layui-btn layui-btn-normal"><i class="layui-icon layui-icon-up"></i>向上</button>
    <br>
    <button onclick="gundongScroll(true)" title="向下滚动" class="layui-btn layui-btn-normal"><i class="layui-icon layui-icon-down"></i>向下</button>
</div>
<script>
    setTimeout(function(){
        $('body').height() - window.innerHeight < 200 && $("#scrollFiexBox").hide(300)
    },3000)
    // 向上或者向下滚动
    var boolScrollTop = false;
    function gundongScroll(bool = true){
        if(boolScrollTop) return false;
        boolScrollTop = true;
        var height = $('body').height()
        var num = (3 + (height/7500))
        if(num > 15) num = 15;  
        var top = height/ num;
        if(top < 1000) top = 1000;
        $("html,body").animate({ scrollTop: (bool ? '+':'-')+"="+ top}, 300);
        setTimeout(function(){
            boolScrollTop = false;
        },300)
    }
</script>